package com.b.domain;

import java.io.Serializable;
import java.math.BigDecimal;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
    * 商品表
    */
@Document(indexName = "product")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Product implements Serializable {
    /**
    * 商品ID
    */
    @Id
    @Field(type = FieldType.Integer, index = true , store = true)
    private Integer id;

    /**
    * 库存
    */
    @Field(type = FieldType.Integer, index = false , store = true)
    private Integer stock;

    /**
    * 标题
    */
    @Field(type = FieldType.Text, index = true , store = true, analyzer = "ik_max_word")
    private String title;

    /**
    * 描述
    */
    @Field(type = FieldType.Text, index = true , store = true, analyzer = "ik_max_word")
    private String description;

    /**
    * 价格
    */
    @Field(type = FieldType.Double, index = false , store = true)
    private BigDecimal price;

    /**
    * 封面图片
    */
    @Field(type = FieldType.Text, index = false , store = true)
    private String coverImage;

    /**
    * 分类ID
    */
    @Field(type = FieldType.Integer, index = true , store = true)
    private Integer categoryId;

    private String type;
}